<%-- 
    Document   : role
    Created on : 25/02/2013
    Author     : Volodymyr Lavrynovych <volodya.lavrynovych@gmail.com>
--%>

<%@page import="mygang.controller.AbstractController"%>
<%@page import="mygang.helper.ApplicationContentHelper"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="mg" tagdir="/WEB-INF/tags"%>
<%
    String title = "Manage roles";
    ApplicationContentHelper helper = new ApplicationContentHelper(request);
%>
<!DOCTYPE html>
<html>
    <head>
        <%=helper.getJQueryDataTable()%>
        <mg:import file="model/manage.js"/>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><%=title%></title>
        <script type="text/javascript">
            $(document).ready(function(){
                window.model = new ManageModel({
                    title: '<%=title%>',
                    itemName: 'Role',
                    actions: {
                        url: '<%=AbstractController.MANAGE_ROLE%>/'
                    },
                    tableOptions: {
                        prepareRow: function(obj){
                            var $row = $('<tr>').attr('id', obj.id);
                            var $name = $('<td>').text(obj.name);
                            var date = new Date(obj.creationDate);
                            var $creationDate = $('<td>').text(date.format(Date.formats.dateOnly));
                            return $row.append($name).append($creationDate);
                        }
                    }
                });
            })
        </script>
    </head>
    <body>
        <div class='target'>
            <table id="dataTable">
                <thead>
                    <tr class="table-caption">
                        <th style="width: 75%;">Name</th>
                        <th style="width: 25%;">Creation date</th>
                    </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </body>
</html>
